package com.feizhoutuobang.shapeline.bo.impl;

import java.io.File;
import java.io.IOException;
import java.util.Date;

import com.feizhoutuobang.shapeline.bo.Article;
import com.feizhoutuobang.shapeline.bo.Feed;
import com.feizhoutuobang.shapeline.util.Calendar;

public class ArticleImpl implements Article {
	
	private String id = "";
	private Feed feed;
	private String title = "";
	private String link = "";
	private String path = "";
	private String publishTime = Calendar.INVALID_TIME;
	private String fetchTime = Calendar.INVALID_TIME;

	@Override
	public String getId() {
		return id;
	}

	@Override
	public void setId(String id) {
		this.id = id;
	}

	@Override
	public Feed getFeed() {
		return feed;
	}

	@Override
	public void setFeed(Feed feed) {
		this.feed = feed;
	}

	@Override
	public String getTitle() {
		return title;
	}

	@Override
	public void setTitle(String title) {
		this.title = title;
	}

	@Override
	public String getLink() {
		return link;
	}

	@Override
	public void setLink(String link) {
		this.link = link;
	}

	@Override
	public File getContent() {
		return new File(path);
	}

	@Override
	public void setContent(File content) {
		try {
			this.path = content.getCanonicalPath();
		} catch (IOException e) {
			//do nothing
		}
	}

	@Override
	public Date getPublishTime() {
		return Calendar.parse(publishTime);
	}

	@Override
	public void setPublishTime(Date publishTime) {
		this.publishTime = Calendar.format(publishTime);	
	}

	@Override
	public Date getFetchTime() {
		return Calendar.parse(fetchTime);
	}

	@Override
	public void setFetchTime(Date fetchTime) {
		this.fetchTime = Calendar.format(fetchTime);
	}

	public String getPublishTime_() {
		return publishTime;
	}
	
	public void setPublishTime_(String publishTime) {
		this.publishTime = publishTime;
	}

	public String getFetchTime_() {
		return fetchTime;
	}
	
	public void setFetchTime_(String fetchTime) {
		this.fetchTime = fetchTime;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}
}
